//
//  NewCityNoticeCell.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/9/14.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class NewCityNoticeCell: BaseTableViewCell {
    
    @IBOutlet weak var bottomSendMargin: NSLayoutConstraint!
    @IBOutlet weak var bottomFirstMagrin: NSLayoutConstraint!
    @IBOutlet weak var bottomLastMargin: NSLayoutConstraint!
    @IBOutlet weak var notieTextLable: UILabel!
    var note : String?{
    
        didSet{
        
        notieTextLable.attributedText = attributedString(str: note!, font: UIFont.systemFont(ofSize: 15))
        
        }
    
    
    }
    

    override func awakeFromNib() {
        super.awakeFromNib()
        contentView.backgroundColor = UIColor.viewBgGrey()
        bottomLastMargin.constant = 0
        bottomSendMargin.constant = 10
        bottomFirstMagrin.constant = 0
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    
    
    
    
    func attributedString(str: String, font: UIFont) -> NSAttributedString? {
        
        // 根据原有字符串生成属性字符串
        let strM = NSMutableAttributedString(string: str)
        
        strM.addAttribute(NSFontAttributeName, value: font, range:NSMakeRange(0, str.characters.count))
        
        strM.addAttribute(NSForegroundColorAttributeName, value: UIColor.black, range:NSMakeRange(0, str.characters.count) )
        
        let paragr = NSMutableParagraphStyle.init()
        
        paragr.lineSpacing = 5;
        
        paragr.paragraphSpacing = 2;
        
        paragr.firstLineHeadIndent = 30;
        
        strM.addAttribute(NSParagraphStyleAttributeName, value: paragr, range: NSMakeRange(0, str.characters.count))
        
        
        return strM
        
    }

    
}
